home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr47 / extmath.zip / EXTADD.S < prev    next >
Text File  |  1993-01-06  |  819b  |  44 lines

  1. ; Add two 64-bit numbers
  2. ;
  3. ; Tim Victor, January 5, 1993
  4. ;
  5. ; Callable from C as follows:
  6. ; int ExtAdd(src, dest);
  7. ;   always return 0
  8. ;
  9.  
  10.         .model  small
  11.         .code
  12.         public _ExtAdd
  13. _ExtAdd proc near
  14.  
  15.         push bp         ; save caller's stack frame
  16.         mov  bp,sp      ; address stack frame of this call
  17.         push si
  18.         push di
  19.  
  20. ; just add four pairs of words
  21.         mov  si,[bp+4]  ; source address
  22.         mov  di,[bp+6]  ; dest address
  23.  
  24.         mov  ax,[si]
  25.         add  [di],ax
  26.         mov  ax,[si+2]
  27.         adc  [di+2],ax
  28.         mov  ax,[si+4]
  29.         adc  [di+4],ax
  30.         mov  ax,[si+6]
  31.         adc  [di+6],ax
  32.  
  33.         sub  ax,ax      ; return 0
  34.  
  35.         pop  di
  36.         pop  si
  37.         pop  bp
  38.  
  39.         ret
  40.  
  41. _ExtAdd endp
  42.         end
  43.  
  44.